package com.example.strategyproject.strategy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author ycd0075
 * @date 2024-01-25 20:49
 */
@Component
public class StrategyManager {
    private final Map<String, IPromotionStrategy> processorHashMap = new HashMap<>(16);

    @Autowired(required = false)
    public void setProcessor(Collection<IPromotionStrategy> list) {
        for (IPromotionStrategy strategy : list) {
            processorHashMap.put(strategy.getType(), strategy);
        }
        System.out.println("processorHashMap: " + processorHashMap);
    }
}
